<?php
require('config.php');
		$type=0;
		if(isset($_REQUEST['type'])) $type=$_REQUEST['type'];
		$time=date('Y-m-d');
		$sql="select a.adId,a.adFile,a.adName,a.adURL,a.adURLApp from `".$oto."_ads` as a where `adPositionId`='{$type}' and `adStartDate`<='$time' and `adEndDate`>='$time'";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$ads[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($ads))
		{
			for($i=0;$i<count($ads);$i++)
			{
				if(isset($ads[$i]['adURLApp']) && $ads[$i]['adURLApp']!=null || $ads[$i]['adURLApp']!="")
				{
					$adURLAPP=explode('|',$ads[$i]['adURLApp']);
					$ads[$i]['adURLApp_type']=$adURLAPP[0];
					$ads[$i]['adURLApp_id']=$adURLAPP[1];
				}
				else
				{
					$ads[$i]['adURLApp_type']='0';
					$ads[$i]['adURLApp_id']='0';
				}
			}
			echo json_encode($ads);
		}
		else echo '[]';
		
?>